﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.Windows.Media;

namespace SLARToolKitWinPhoneSample
{
    public partial class Page3 : PhoneApplicationPage
    {
        public Page3()
        {
            InitializeComponent();

            string[] arr1 = new string[] { "Ribena", "Iced Lemon Tea", "Orange Juice", "Sprite", "Coke", "Coke Light", "Iced Milo", "Hot Milo" };

            string[] images = new string[] { "Ribena", "LemonTea", "OrangeJuice", "Sprite", "Coke", "Coke","Milo","Milo2" };

            for (int i = 0; i < arr1.Length; ++i)
            {
                List_row row = new List_row();
                row.title.Text = arr1[i];

                row.myimage.Source = (ImageSource)new ImageSourceConverter().ConvertFromString("BeveragesImages/" + images[i] + ".png");
                BeverageList.Items.Add(row);

            }


            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
        }
        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {

        }
        void BeverageList_SelectionChanged(object sender, SelectionChangedEventArgs args)
        {
            int BIndex = BeverageList.SelectedIndex + 1;

            switch (BIndex)
            {
                case 1:
                    NavigationService.Navigate(new Uri("/Beverages/Be1.xaml", UriKind.Relative));
                    break;

                case 2:
                    NavigationService.Navigate(new Uri("/Beverages/Be2.xaml", UriKind.Relative));
                    break;

                case 3:
                    NavigationService.Navigate(new Uri("/Beverages/Be3.xaml", UriKind.Relative));
                    break;

                case 4:
                    NavigationService.Navigate(new Uri("/Beverages/Be4.xaml", UriKind.Relative));
                    break;

                case 5:
                    NavigationService.Navigate(new Uri("/Beverages/Be5.xaml", UriKind.Relative));
                    break;

                case 6:
                    NavigationService.Navigate(new Uri("/Beverages/Be6.xaml", UriKind.Relative));
                    break;

                case 7:
                    NavigationService.Navigate(new Uri("/Beverages/Be7.xaml", UriKind.Relative));
                    break;

                case 8:
                    NavigationService.Navigate(new Uri("/Beverages/Be8.xaml", UriKind.Relative));
                    break;


                default:
                    break;
            }
        }
    }
}